package top.canyue.word_range_service.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import top.canyue.word_range.pojo.po.Word;

@Mapper
public interface WordMapper extends BaseMapper<Word> {

    @Insert("INSERT IGNORE INTO word(word,difficulty_level) values(#{word},#{difficultyLevel})")
    Integer insertIgnoreInto(Word word);

    // 用于查询book_id对应的单词数量
    @Select("SELECT COUNT(1) FROM word_mapping WHERE book_id = #{bookId} ")
    Integer countByBookId(String bookId);

}
